#ifndef UTILS_H_
#define UTILS_H_

#include <string>

#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
  TypeName(const TypeName&);		   \
  void operator=(const TypeName&)


struct DocInfo {
  int doc_len;
  std::string url;
  std::string title;
};



void trim(std::string&);

bool is_greater(const std::pair<int, float> &lhs,
    const std::pair<int, float> &rhs);

template<class T>
void QuickSort(T* Data, int low, int high) {
  if (low < high) {
    int i = low, j = high;
    T temp = Data[low];
    while (i != j) {
      while (j > i && Data[j] > temp)
        j--;
      if (j > i) {
        Data[i] = Data[j];
        i++;
      }
      while (i < j && Data[i] < temp)
        i++;
      if (i < j) {
        Data[j] = Data[i];
        j--;
      }
    }

    Data[i] = temp;

    QuickSort(Data, low, i - 1);
    QuickSort(Data, i + 1, high);
  }
}

#endif
